package com.zc.controller.yyc.controller;

import com.zc.controller.yyc.po.Student;
import com.zc.controller.yyc.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("yyc")
public class YycController {


    @Autowired
    StudentService service;

    @RequestMapping("query")
    @ResponseBody
    public List<Student> query() {
        return service.query();
    }
    @RequestMapping("delete")
    @ResponseBody
    public String  delete(int id){
       service.delete(id);
        return "1";
    }
    @RequestMapping("saveOrupdate")
    @ResponseBody
    public String update(Student student) {
        service.saveOrupdate(student);
        return "1";
    }
    @RequestMapping("queryByid")
    @ResponseBody
    public Student queryByid(Student student) {
        return service.queryByid(student);
    }

}
